<%@ page language="java"
	import="java.util.*,bookstore.database.pojo.*,bookstore.tools.*"
	pageEncoding="UTF-8"%>
<%
	

	List<Book> books = (List<Book>) request.getSession().getAttribute(
			"searchBooks");
	String curpage = (String) request.getAttribute("curpage");
	String type = (String)session.getAttribute("seltype");
	String keywords = (String)session.getAttribute("keywords");
	
	int pageNow = 1;
	if (curpage != null) {
		pageNow = Integer.parseInt(curpage);
	}

	int pageNum = Tools.getSearchPageSize(type,keywords);
	
	if (books == null) {
		books = Tools.getBooks("全部分类");
	}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		

		<title>我mai 搜索结果</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
a:link {color: #0066FF}	/* 未访问的链接 */
a:visited {color: #0066FF}/* 已访问的链接 */
a:hover {color: #FF6600}/* 鼠标移动到链接上 */
a:active {color: #0000FF}/* 选定的链接 */

</style>
	</head>

	<body>
		<table width="80%" border="0" align="center">
			<tr>
				<td colspan="2"><jsp:include flush="true" page="head.jsp"></jsp:include></td>
			</tr>
			<tr>
				<td width="30%"><jsp:include flush="true" page="left.jsp"></jsp:include></td>
				<td>
					<table width="100%" border="0">
	<tr>
		<td width="2%" rowspan="7" bgcolor="#66CCCC">
			<div align="center"></div>
			<div align="center"></div>
			<div align="center"></div>
			<div align="center"></div>
			<div align="center"></div>
			<div align="center"></div>
			<div align="center"></div>
		</td>
		<td colspan="4">
			<div align="center">
				<img src="img/goodslist.jpg" width="213" height="34" />
			</div>
		</td>
		<td width="2%" rowspan="7" bgcolor="#66CCCC">
			&nbsp;
		</td>
	</tr>
	<%
		int time = 0;
		for (int i = 0; i < 2; i++) {
	%><tr>
		<%
			for (int j = 0; j < 4; j++) {

					String picth = "";
					String name = "";
					String path = "";
					int flag = 0;
					if (time >= books.size()) {
						name ="暂无售书信息";
						picth = "image/none.jpg";
					} else {
						flag = 1;
						Book book = books.get(time);
						picth = book.getImage().getImagePath();
						name = book.getBname();
						String isbn = book.getIsbn();
						path = "bookDetail.do?isbn=" + isbn;
						time++;
					}
		%>
		<td width="24%">
			<div align="center">
				<img src=<%=picth%> width="150" height="150" />
			</div>
			<div align="center">
				<%
					if (flag == 0) {
				%>
				<%=name%>
				<%
					} else {
				%>
				<a href=<%=path%>><%=name%> </a>
				<%
					}
				%>
			</div>
		</td>
		<%
			}
		%>
	</tr>
	<%
		//判断是否第一大行结束
			if (i == 0) {
	%>
	<tr>
		<td colspan="4" bgcolor="#33FF99">
			&nbsp;
		</td>
	</tr>
	<%
		}
		}
	%>
	<tr>
		<td colspan="4">
			<div align="center">
				<%
					for (int i = 1; i <= pageNum; i++) {
				%>
				<a href="newSearchResult.do?curpage=<%=i%>">【<%=i%>】</a>
				<%
					}
				%>
			</div>
		</td>
	</tr>
</table>
				</td>
			</tr>
			<tr>
				<td colspan="2"><jsp:include flush="true" page="tail.jsp"></jsp:include></td>
			</tr>
		</table>
	</body>
</html>
